﻿/*
=============================================================================
Author:魏宝辉通过CodeSmithe生成
CreatedTime:2012-10-31
Description:iptable三层结构数据访问层
=============================================================================
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using PWMIS.DataMap.Entity;
using FTchina.Models;//引入模型层
namespace FTchina.DAL
{
	public static partial class IptableService
	{
		 
	 
			
		public static int DeleteIptableById(int id)	
		{     
            Iptable iptable = new Iptable();
            iptable.Id = id;
            EntityQuery<Iptable> query = new EntityQuery<Iptable>(iptable);
             return query.Delete(iptable);
		}	
        
          //以标识列获得对象
        public static Iptable GetIptableById(int  id)
        {
            Iptable iptable = new Iptable();
            iptable.Id = id;
            EntityQuery<Iptable> query = new EntityQuery<Iptable>(iptable);
            query.FillEntity(iptable);
            return iptable;
        }
		
	 
	 
       
        
        
        
		 
		 
		 public static int AddOrUpdateIptable(Iptable iptable)
        {
            Iptable _iptable = new Iptable();

            EntityQuery<Iptable> query = new EntityQuery<Iptable>(_iptable);
           _iptable= iptable;
           int i=(iptable.Id==0)?
                 query.Insert(_iptable): query.Update(_iptable);
            return i;
        }
		
		 
	}
}

